<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org"
      lang="zh-cn">
<head>
    <meta content="云之讯,云通讯,云通讯平台" name="keywords"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
    <title>短信云平台运营系统 - 管理员中心</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <link th:href="@{/resources/css/bootstrap.min14ed.css?v=3.3.6}" rel="stylesheet">
    <link th:href="@{/resources/css/font-awesome.min93e3.css?v=4.4.0}" rel="stylesheet"><!-- jqgrid-->
    <link th:href="@{/resources/js/plugins/jqgrid/css/ui.jqgrid-bootstrap.css}" rel="stylesheet">
    <link th:href="@{/resources/css/animate.min.css}" rel="stylesheet">
    <link th:href="@{/resources/css/style.min862f.css?v=4.1.0}" rel="stylesheet">
    <link th:href="@{/resources/css/plugins/sweetalert/sweetalert.css}" rel="stylesheet">
    <link th:href="@{/resources/css/select2.css}" rel="stylesheet">
    <style>
        /* Additional style to fix warning dialog position */
        #alertmod_table_list_2 {
            top: 900px !important;
        }
        .close{
            opacity: 1;
        }
        .modal-content{
            opacity: 1 !important;
            border:none;
        }
        .select2 span{
            display:block !important;
            margin-top: 0px !important;
        }
        .select2-container {
            width: 171px !important;
        }
        .select2-dropdown {
            width: 175px !important;
        }
        .select2-container .select2-selection--single{
            width:175px;
        }
        .mr20{
            margin-right: 20px;
        }
    </style>
</head>
<body class="gray-bg"><div th:replace="stat :: statCode"></div>
<div class="wrapper wrapper-content  animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li th:if="${menus.znmb286}"><a href="/autoTemplate/autoTemplateQuery">智能模板</a></li>
                    <li th:if="${menus.tymb}" class="active" id="agentTab2"><a>通用模板</a></li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" th:if="${menus.tymb}">
                        <div class="panel-body">
                            <div class="row">
                                <div class="col-sm-12">
                                    <div class="ibox ">
                                        <!-- 搜索条件 -->
                                        <div class="ibox-content">
                                            <form role="form" class="form-inline" id="mainForm" method="post">
                                                <div class="form-group mr20">
                                                    <label>模板属性:</label>
                                                    <select class="form-control" name="smsType" id="smsTypeID">
                                                        <option value="">全部属性</option>
                                                        <option value="10">行业</option>
                                                        <option value="11">会员营销</option>
                                                    </select>
                                                </div>
                                                <div class="form-group mr20">
                                                    <label>模板类型:</label>
                                                    <select class="form-control" name="templateType"
                                                            id="templateTypeID">
                                                        <option value="">全部类型</option>
                                                        <option value="0">固定模板</option>
                                                        <option value="1">变量模板</option>
                                                    </select>
                                                </div>
                                                <div class="form-group mr20">
                                                    <label>模板ID:</label>
                                                    <input type="text" placeholder="请输入模板ID" id="templateID"
                                                           class="form-control"
                                                           name="templateId">
                                                </div>
                                                <div class="form-group mr20">
                                                    <label>模板内容:</label>
                                                    <input type="text" placeholder="模板内容" id="condition"
                                                           class="form-control"
                                                           name="content">
                                                </div>
                                                <span>&nbsp;&nbsp;<button type="button" class="btn btn-sm btn-danger"
                                                                          onclick="search()">搜索</button></span>
                                            </form>
                                        </div>

                                        <div class="ibox-content">
                                            <div class="jqGrid_wrapper">
                                                <table id="table_list"></table>
                                                <div id="pager_list"></div>
                                            </div>
                                            <p>&nbsp;</p>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:src="@{/resources/js/jquery.min.js?v=2.1.4}"></script>
<script th:src="@{/resources/js/bootstrap.min.js?v=3.3.6}"></script>
<script th:src="@{/resources/js/content.min.js?v=1.0.0}"></script>
<script th:src="@{/resources/js/plugins/layer/laydate/laydate.js}"></script>
<script th:src="@{/resources/js/plugins/peity/jquery.peity.min.js}"></script>
<script th:src="@{/resources/js/plugins/jqgrid/js/i18n/grid.locale-cn.js}"></script>
<script th:src="@{/resources/js/plugins/jqgrid/js/jquery.jqGrid.min.js}"></script>
<script th:src="@{/resources/js/date_format.min.js?v=1.0.0}"></script>
<script th:src="@{/resources/js/plugins/sweetalert/sweetalert.min.js}"></script>
<script th:src="@{/resources/js/common.js?v=1.0.0}"></script>
<script th:src="@{/resources/js/auth.js}"></script>
<script th:src="@{/resources/js/select2.min.js}"></script>
<script th:src="@{/resources/js/layer/layer.js}"></script>
<script th:src="@{/resources/js/jquery.form.js?v=1.0.0}"></script>



<script th:inline="javascript">
    /*<![CDATA[*/
    var max_export_num = [[${max_export_num}]];

    function search(){
        $("#table_list").jqGrid('setGridParam',{
            datatype:'json',
            postData: {
                templateId: $("#templateID").val(),
                clientId: $("#clientId").val(),
                smsType: $("#smsTypeID").val(),
                content: $("#condition").val(),
                templateType: $("#templateTypeID").val()
            }, //发送数据
            page:1
        }).trigger("reloadGrid"); //重新载入
    }

    $(document).ready(function () {
        $.jgrid.defaults.styleUI = "Bootstrap";
        $("#table_list").jqGrid({
            url:/*[[@{/comTemplate/comTemplateQuery}]]*/'',
            mtype: 'POST',
            datatype: "json",
            jsonReader : {
                root:"entityList",
                page: "currentPage",
                total: "totalPage",
                records: "totalCount"
            },
            height: 'auto',
            rownumbers:true,
            autowidth: true,
            shrinkToFit: true,
            autoScroll: true,
            rowNum: 20,
            rowList: [10, 20, 30,50],
            colNames: [ "模板ID","模板属性", "模板类型", "模板内容"],
            colModel: [
                {name: "templateId",align: "left",sortable:false,width:'60'},
                {name: "smsType", align: "left",sortable:false,width:'80',
                    formatter:function(cellvalue,options,rowObject){
                        if(rowObject.smsType == 10){
                            cellvalue = '行业';
                        }else if(rowObject.smsType == 11){
                            cellvalue = '会员营销';
                        }else {
                            cellvalue='';
                        }
                        return cellvalue;
                    }
                },
                {name: "templateType", align: "left",sortable:false,width:'80',
                    formatter:function(cellvalue,options,rowObject){
                        if(rowObject.templateType == 0){
                            cellvalue = '固定模板';
                        }else if(rowObject.templateType == 1){
                            cellvalue = '变量模板';
                        }
                        return cellvalue;
                    }
                },
                {name: "content", align: "left",sortable:false,width:'200',
                    formatter:function(cellvalue,options,rowObject){
                        var switcher = "<span str='"+  rowObject.content +"' class='table-contant'></span>";

                        return switcher;
                    }
                },
            ],
            pager: "#pager_list",
            viewrecords: true,
            hidegrid: false,
            gridComplete:function(){

                $(".table-contant").each(function(){
                    var str = $(this).attr("str");
                    $(this).text(str);
                });

            }
        });

        $(window).bind("resize", function () {
            var width = $(".jqGrid_wrapper").width();
            $("#table_list").setGridWidth(width);
        })


        function keyUp(e) {
            var currKey=0,e=e||event;
            currKey=e.keyCode||e.which||e.charCode;
            var keyName = String.fromCharCode(currKey);
            if (currKey == 13){
                search();
            }
        }
        document.onkeyup = keyUp;

    });

    /*]]>*/
</script>
</body>
</html>